home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
cwscr.exe
/
MYSCR.H
< prev
next >
Wrap
Text File
|
1991-05-22
|
4KB
|
146 lines
/*
Text Screen module class specification.
This is the header file that should be used when text based output
to the screen is desired.
Library : mycpp.lib
*/
#ifndef __MYSCR_H__
#define __MYSCR_H__
static char MyScrh_Id[] = "myscr.h 1.10 05/22/91";
/*
Version notes :
1.00 - Original creation / release. ( 2-14-91 CW )
1.10 - Added scroll function. Also changed all char * modifiers to
const char *. ( 5-22-91 CW )
*/
#include <string.h>
/* ================================================================== */
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
typedef enum { Scroll_Up, Scroll_Down } ScrollDir;
typedef struct {
unsigned char ch;
unsigned char attrib;
} scr_type;
typedef struct {
int x, y, w, h;
scr_type *scr_ptr;
} save_type;
/* ------------------------------------------------------------------ */
class myScreen {
scr_type far *screen;
scr_type far *tscr;
int cursor_flag; // true if cursor is visible.
void init();
public:
myScreen(){ init(); };
~myScreen(){ if( !cursor_flag ) cursor_show(); };
void print( int x, int y, int attr, const char *str );
void print( int x, int y, const char *str ){
print( x, y, -1, str );
};
void print( int x, int y, int attr, const char chr );
void print( int x, int y, const char chr ){
print( x, y, -1, chr );
};
void clear( int x, int y, int w, int h, int attr = -1 );
void clear( int x, int y, int attr = -1 ){
clear( x, y, 1, 1, attr );
};
void clear( int attr = -1 ){
clear( 0, 0, 80, 24, attr );
};
void change( int x, int y, int w, int h, int attr );
void change( int x, int y, int attr ){
change( x, y, 1, 1, attr );
};
void change( int attr ){
change( 0, 0, 80, 24, attr );
};
void scroll( ScrollDir dir, int x, int y, int w, int h, const char *str );
void scroll( ScrollDir dir, int x, int y, int w, int h ){
scroll( dir, x, y, w, h, "" );
};
void scroll( ScrollDir dir, const char *str ){
scroll( dir, 0, 0, 80, 24, str );
};
void scroll( ScrollDir dir ){
scroll( dir, 0, 0, 80, 24, "" );
};
const save_type *save( int x, int y, int w, int h );
void restore( const save_type *data );
void cursor_move( int x, int y );
void cursor_show();
void cursor_hide();
int cursor_is_on(){ return( cursor_flag ); };
};
/* :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:- */
/*
The rest of this header file contains useful hash defines that can
be used to specify the values for the attribute ( attr ) parameters
in the above functions.
*/
#define SCR_F_Black (0)
#define SCR_F_Blue (1)
#define SCR_F_Green (2)
#define SCR_F_Cyan (3)
#define SCR_F_Red (4)
#define SCR_F_Purple (5)
#define SCR_F_Yellow (6)
#define SCR_F_White (7)
#define SCR_B_Black (SCR_F_Black << 4)
#define SCR_B_Blue (SCR_F_Blue << 4)
#define SCR_B_Green (SCR_F_Green << 4)
#define SCR_B_Cyan (SCR_F_Cyan << 4)
#define SCR_B_Red (SCR_F_Red << 4)
#define SCR_B_Purple (SCR_F_Purple << 4)
#define SCR_B_Yellow (SCR_F_Yellow << 4)
#define SCR_B_White (SCR_F_White << 4)
#define SCR_Fi_Black (SCR_F_Black | 8)
#define SCR_Fi_Blue (SCR_F_Blue | 8)
#define SCR_Fi_Green (SCR_F_Green | 8)
#define SCR_Fi_Cyan (SCR_F_Cyan | 8)
#define SCR_Fi_Red (SCR_F_Red | 8)
#define SCR_Fi_Purple (SCR_F_Purple | 8)
#define SCR_Fi_Yellow (SCR_F_Yellow | 8)
#define SCR_Fi_White (SCR_F_White | 8)
#define SCR_Bb_Black (SCR_B_Black | 8)
#define SCR_Bb_Blue (SCR_B_Blue | 8)
#define SCR_Bb_Green (SCR_B_Green | 8)
#define SCR_Bb_Cyan (SCR_B_Cyan | 8)
#define SCR_Bb_Red (SCR_B_Red | 8)
#define SCR_Bb_Purple (SCR_B_Purple | 8)
#define SCR_Bb_Yellow (SCR_B_Yellow | 8)
#define SCR_Bb_White (SCR_B_White | 8)
/* :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:- */
#endif